home *** CD-ROM | disk | FTP | other *** search
/ How Many Bugs in a Box / How Many Bugs in a Box.cdr / bugs / act7 / 00159.ls < prev    next >
Encoding:
Text File  |  1995-03-28  |  2.0 KB  |  75 lines

  1. on handlebugs
  2.   global sblist, animtimer, phasetime, idealnum, sndopen, mybugsound, captivechannel, grabcur, reachcur
  3.   animateall()
  4.   startTimer()
  5.   set animtimer to 5
  6.   set phasetime to the timer
  7.   set during to the timer + 360
  8.   set lastadd to the timer
  9.   repeat while not (the mouseDown)
  10.     if count(sblist) > 10 then
  11.       if (random(30 - count(sblist)) = 1) or (count(sblist) > 18) then
  12.         settask(getAt(sblist, random(count(sblist))), #frighten)
  13.       end if
  14.     end if
  15.     if ((the timer - phasetime) > 8) and (count(sblist) > 5) then
  16.       settask(getAt(sblist, random(count(sblist))), #frighten)
  17.       set idealnum to count(sblist) - 1
  18.       if idealnum < 5 then
  19.         set idealnum to 5
  20.       end if
  21.     end if
  22.     set phasetime to the timer
  23.     repeat while the timer < animtimer
  24.       updateStage()
  25.     end repeat
  26.     animateall()
  27.     set animtimer to the timer + 3
  28.     if (the timer - lastadd) > 60 then
  29.       addbug()
  30.       set lastadd to the timer
  31.       set animtimer to 5
  32.     end if
  33.     updateStage()
  34.   end repeat
  35.   if rollOver(47) and the mouseDown then
  36.     go(the frame)
  37.     exit
  38.   end if
  39.   set mycur to point(the mouseH, the mouseV)
  40.   set gotabug to 0
  41.   repeat with xxx = 1 to count(sblist)
  42.     set sbnum to getPropAt(sblist, xxx)
  43.     set rectaman to rect(the left of sprite sbnum, the top of sprite sbnum, the right of sprite sbnum, the bottom of sprite sbnum)
  44.     if inside(mycur, rectaman) then
  45.       catchbug(sbnum, getAt(sblist, xxx))
  46.       set gotabug to 1
  47.       exit repeat
  48.     end if
  49.   end repeat
  50.   if gotabug > 0 then
  51.     cursor([grabcur, grabcur + 1])
  52.     repeat while the mouseDown
  53.       if the timer > animtimer then
  54.         animateall()
  55.         set animtimer to the timer + 3
  56.       end if
  57.       if the timer > 60 then
  58.         addbug()
  59.         startTimer()
  60.         set animtimer to 5
  61.       end if
  62.       updateStage()
  63.     end repeat
  64.     sound stop 2
  65.     releasebug()
  66.     if captivechannel > 0 then
  67.       if sprite captivechannel intersects 3 then
  68.         InTheCagePal()
  69.       end if
  70.     end if
  71.     cursor([reachcur, reachcur + 1])
  72.   end if
  73.   go(the frame)
  74. end
  75.